#!/usr/bin/python2.7
#-*-encoding:utf8-*-
import os,sys,statvfs

class Check:

    def __init__(self):
        self.warn = ''

    def disk_check(self):
        vfs = os.statvfs("/home")  
        available=vfs[statvfs.F_BAVAIL]*vfs[statvfs.F_BSIZE]/(1024*1024*1024)
        capacity=vfs[statvfs.F_BLOCKS]*vfs[statvfs.F_BSIZE]/(1024*1024*1024)
        used=capacity-available
        if used*1.0/capacity > 0.2:
            self.warn = 'space left less than 80%.'
            return [True,self.warn]
        else:
            warn=''
            return [False,self.warn]

    def data_check(self):
        self.warn='data check warning'
        return [True,self.warn]
    
